package com.service;


import com.dao.AccountDao;
import com.pojo.Account;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AccountServiceImpl implements AccountService {

    @Autowired
    private AccountDao accountDao;

//    @Autowired
//    public AccountServiceImpl(AccountDao accountDao){
//        this.accountDao = accountDao;
//    }

    public void transfer(String userOut, String userIn, int money){
        accountDao.out(userOut,money);
        accountDao.in(userIn,money);
    }

    @Override
    public void findAll() {

    }

    @Override
    public void save(Account account) {
        accountDao.add(account);
    }

    @Override
    public Account findAccountById(int id) {
        Account account = accountDao.findAccountById(id);
        System.out.println("findAccountById:"+account);
        return account;
    }
}
